#!/usr/bin/python

# Ugh, now to figure out how to import without __import__. Maybe execfile().

import ihooks,imp,os

# Import custom source
def import_src(fname):
    rpath = './src/' + fname.replace('.','/')
    loader = ihooks.BasicModuleLoader()
    path, fname = os.path.split(rpath) # Overwrite fname with the actual filename
    name, ext = os.path.splitext(fname)
 
    m = loader.find_module_in_dir(name, path)
    if not m:
        raise ImportError, name
 
    m = loader.load_module(name, m)
    return m
 
# Import dependancy
def import_src(fname):
    rpath = './src/dep/' + fname.replace('.','/')
    loader = ihooks.BasicModuleLoader()
    path, fname = os.path.split(rpath) # Overwrite fname with the actual filename
    name, ext = os.path.splitext(fname)
 
    m = loader.find_module_in_dir(name, path)
    if not m:
        raise ImportError, name
 
    m = loader.load_module(name, m)
    return m

FastUtils = import_src('FastUtils')
Network = import_src('Network')
Deal = import_src('Deal')
